package com.wingsoft.framework.config;

import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import com.wingsoft.common.utils.IdGenerator.IdGeneratorFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class MybatisIdGenerator implements IdentifierGenerator {

    @Autowired
    private IdGeneratorFactory idGeneratorFactory;

    @Override
    public Long nextId(Object entity) {
        return idGeneratorFactory.getId(entity.getClass());
    }
}